package com.cy.pj.sys.web.controller;

import com.cy.pj.sys.pojo.SysHotel;
import com.cy.pj.sys.service.SysHotelService;
import com.cy.pj.sys.web.pojo.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/hotel/")
@RestController
public class SysHotelController {
    @Autowired
    private SysHotelService sysHotelService;


    @GetMapping
    public JsonResult selectHotes(){
        return new JsonResult(sysHotelService.selectHotes());
    }


    @PostMapping
    public JsonResult insertHotel(@RequestBody SysHotel hotel){
        sysHotelService.insertHotel(hotel);
        return new JsonResult("save ok");
    }

    @DeleteMapping("{historyOrderId}")
    public JsonResult doDeleteById(@PathVariable Long... historyOrderId){
        sysHotelService.deleteById(historyOrderId);
        return new JsonResult("delete ok");
    }

    @PutMapping
    public JsonResult UpdateHotel(@RequestBody SysHotel sysHotel){
        sysHotelService.updateHotel(sysHotel);
        return new JsonResult("update ok");
    }

}
